home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / clipper / ks94an.zip / SYS_HELP.HDR < prev    next >
Text File  |  1994-04-25  |  19KB  |  434 lines

  1. /******************************************************************************
  2.                  The Klipper Library, for CA-Clipper 5.x
  3.         Copyright (c), 1994, Wallace Information Systems Engineering
  4.  
  5. FUNCTION:
  6.  
  7. Help() --> NIL
  8.  
  9. PARAMETERS:
  10.  
  11. None
  12.  
  13. SHORT:
  14.  
  15. General Purpose Context-Sensitive On-Line Help system.
  16.  
  17. DESCRIPTION:
  18.  
  19. Help() is a self-contained, data driven, general purpose, help facility.
  20.  
  21. Field level help is implemented by way of determining the current VAR_NAME =
  22. readvar().  Field help can therefore be present in the on-line help but will
  23. not be included in the printed manual (unless you include them by means of a
  24. chap/sect/para entry).
  25.  
  26. Field level help appears in the resulting text before any other help text if
  27. field level help is found in the sys_help file.
  28.  
  29. OVERVIEW
  30.  
  31. Make no mistake.  No matter what anyone tells you, on-line, context sensitive
  32. help requires careful thought and planning. There are no quick-fixes to the
  33. problem of getting users of your Clipper Application information related to
  34. the work at hand.  In order to be truely context sensitive, your help system
  35. must know what the current "context" is.  It must also be able to determine
  36. what other information is not exactly, but closely related.
  37.  
  38. In order to fully understand and exploit the Klipper Help() function, you
  39. need to understand one fundamental concept.  The Klipper Help() Function is a
  40. paragraph constructor.  On-Line help is composed of individual pieces of
  41. information on very specific topics related to a theme.  Help texts are built
  42. by compiling together paragraphs of help text that are pertinent to the
  43. "theme" in question, into a single help text which is then displayed.
  44.  
  45. Since the Help() Function is a paragraph constructor, in order to create a
  46. neat and "flowing" appearance to your help text, you must write individual
  47. paragraphs in such a manner that they might appear to have come "from"
  48. anywhere else and be able to lead into anything else that is related.  Almost
  49. like intentionally writting an open-ended sentence, only in paragraph form.
  50. For instance, if you have three pieces of information regarding editing
  51. commands, it would not do to begin each paragraph with "Editing Commands for
  52. ..... are ....." because in the resulting help text, you will end up with:
  53.  
  54. Editing Commands for Fields are...
  55. Editing Commands for cursor movement are...
  56. Editing Commands for Quiting and Saving are...
  57.  
  58. ... which is how a three year old speaks.  Three editing command paragraphs
  59. might better simply begin as if you were already on the topic:
  60.  
  61. First Paragraph     : Editing Commands for Fields are ....
  62. Second Paragraph    : To Move the Cursor...
  63. Third Paragraph     : Press ESC to Quit and optionally save...
  64.  
  65. Which would result in:
  66.  
  67. Editing Commands for Fields area ....
  68. To Move the Cursor...
  69. Press ESC to Quit and optionally save...
  70.  
  71. ...which flows much smoother.  You will quickly catch on to this after you
  72. compose a few paragraphs and see what it looks like when the complete help
  73. text is constructed.  Full examples are given later.
  74.  
  75. On line help can be provided to any system with minimal modification.  The
  76. way the On-Line Help Sub-System works is really quite simple.  At any time
  77. that the user presses F1, the Help() function is called.  It expects to find
  78. a character variable declared in the calling procedure called Help_Label.
  79. This variable should contain a Help Key that will be located in the help
  80. database.  The Help_Label may contain several keys combined together (with
  81. the "+" symbol) and help topics will be included for each of the individual
  82. keys.  The Help system includes features such as:
  83.  
  84. ? Context Sensitive Help
  85. ? Configurable down to individual field level
  86. ? Topical Index
  87. ? Zoom to full screen on any text
  88. ? Word Search through Help Text
  89. ? Print Help Text to Local or Network Printer
  90. ? User Entered Notes added along-side System Help
  91.  
  92. When the user is finished looking at the help text, they can return to their
  93. application at exactly the point they left it, even if they were in the
  94. middle of a READ.  The On-Line Help System can pop up even over a data entry
  95. screen.
  96.  
  97. TECHNICAL DETAILS
  98.  
  99. The On-Line Help Sub-System is data driven from a database called
  100. SYS_HELP.DBF.  The structure is as follows:
  101.  
  102. HELP_LABEL, C, 40
  103. INDEX,      C, 40
  104. PROC_NAME,  C, 10
  105. VAR_NAME,   C, 10
  106. TEXT,       M
  107. USER_TEXT,  M
  108.  
  109. The fields are defined as follows:
  110.  
  111. HELP_LABEL:  This field contains the Help_Label to locate when the On-Line
  112. Help Sub-System is called.
  113.  
  114. The Help_Label is a character variable that you create and "drop" into your
  115. code at various places so that when F1 is pressed, the contents Help_Label
  116. reflect the help that needs to be generated for the particular subject area.
  117.  
  118. The contents of this variable control the different ascpects of the help
  119. system's behaviour.  The contents of this variable may be a single word
  120. indicating a single help topic to be displayed (ie, "BUDGETSCREENHELP") or
  121. there may be multiple words indicating several subjects to be gathered.  In
  122. this case, the words MUST be separated by a PLUS SIGN (ie, "HLP1+HLP2+HLP3").
  123.  
  124. Recall that this help function is a paragraph constructor.  It compiles help
  125. from individual help paragraphs that can be combined in all sorts of ways and
  126. in all sorts of different places, as appropriate.  This makes common
  127. individual subjects available for reuse throughout the application.
  128.  
  129. First, if the "HELP_LABEL" variable does not exist, or is not in scope (ie,
  130. available to the help system function) when the help function is executed,
  131. then the user will see "No help available for this subject - END OF SYSTEM
  132. HELP."
  133.  
  134. The Help_Label variable will change, as your application proceeds.  You can
  135. include a single Help_Label key, or several to be handled as separate
  136. "elements" to extract from the help database.  Again, the delimiter for this
  137. is the plus sign "+".
  138.  
  139. For instance if, at any particular point in you application your Help_Label
  140. is "MEUHELP" then when the help function is executed and this string is
  141. parsed, it will pull help for "MENUHELP" only from the help database.
  142. However, you may want more than one help text added to the complete help
  143. text:
  144.  
  145.     Help_Label = "BUDGET_EDIT+BUDGET_ACCOUNTS+EDIT_COMMANDS"
  146.  
  147. In this case, the resulting help text will contain three paragraphs, all
  148. obtained from separate help text fields in the help database.
  149.  
  150. The Help_Label, in addition to containing multiple help subjects, separated
  151. by a plus sign, can also contain additional elements that instruct the help
  152. system to behave differently.
  153.  
  154. Some systems use a screen design "standard," often dictated in large
  155. corporations.  If your screens all have a unique identifying mark, you can
  156. use this mark as your help_label rather than "dropping" help_labels all over
  157. your code.  In fact, if you know that you can always identify any part of
  158. your system by some label in a permananet location on the screen, you can
  159. make a single Help_Label declaration at the top of your program that will
  160. tell the help system to always get it's Help_Label from there.
  161.  
  162. If the Help_Label contains a comma "," (*ONE* comma) anywhere in it, it is
  163. assumed that you want to extract the help_label from some place ON THE SCREEN
  164. by specifying the SCREEN LINE number and a TOKEN which the help_label
  165. immediately follows. In this case, the Help_Label variable contains two
  166. "parameters" separated by a comma.
  167.  
  168. The first parameter is the line number of the screen on which to look for the
  169. token specified in the second parameter.  The Help_Label then becomes
  170. whatever text immediately follows the specified token up to but not including
  171. the first non-alphanumeric character on the screen.
  172.  
  173. Say for instance that the screen has, on line 24, the text:
  174.  
  175.     "SCREEN_ID: BUDGET1002 - BUDGETS - XYZ Corp"
  176.  
  177. To use "BUDGET1002" as the help label for this screen, simply set Help_Label
  178. to contain:
  179.  
  180.     HELP_LABEL = "24,SCREENID: "
  181.  
  182. In this case, the COMMA is a delimiter.  It tells the function that, since
  183. you passed TWO parameters, then the first one is a screen line number, and
  184. the second is text to locate on that line and extract Help_Label from what
  185. follows it.  The function will begin reading on line 24, on the first
  186. character AFTER "SCREENID: " and continue reading until it encounters the
  187. first non-alphanumeric character (which in this case is a space).  From the
  188. above example, the Help_Label variable that the help function would build for
  189. itself would contain "BUDGET1002" and it would then proceed as normal,
  190. gathering help from the help database for "BUDGET1002."
  191.  
  192. If Help_Label contains *TWO* commas (THREE parameters), the behaviour is
  193. similar to the above case of 1 comma (two parameters) and the variable is
  194. interpreted thusly:
  195.  
  196. The first parameter is a screen line, the second parameter is a screen
  197. column, and the third parameter is a number indicating the number of
  198. characters to read from the screen.  This value is then used as the
  199. Help_Label:
  200.  
  201.     Help_Label = "24,65,5"
  202.  
  203. This indicates that the help_label is to be read from the screen; five
  204. characters beginning at line 24 and column 65.
  205.  
  206. INDEX: This field contains the Index Entry for the associated Help_Label.
  207. This field comprises the Topical Index when it is requested.  The Topical
  208. Index presents this column of the database in alphabetical order when F1 is
  209. pressed from within the On-Line Help Sub-System.
  210.  
  211. PROC_NAME: (unused) This field is reserved for future use.
  212. VAR_NAME: (unused) This field is reserved for future use.
  213.  
  214. TEXT: This is a memo field that contains the help text that is displayed for
  215. the current Help_Label variable (if it isn't being derived from the screen).
  216.  
  217. USER_TEXT: This is a memo field that contains the user-entered notes that are
  218. entered alongside the system defined help when the user presses "F4 - Notes."
  219.  
  220. Calling Convention, Parameters and Usage Notes
  221.  
  222. Syntax: (In your application:)
  223.  
  224. SET KEY nnn TO HELP() or
  225. EXTERNAL HELP
  226.  
  227. Source Code Examples and Explanations
  228.  
  229. In brief, when the user presses F1 to activate the On-Line Help, the program
  230. branches to the Help() function.  At this time, the Help() function scans the
  231. run-time environment looking for a character variable called "Help_Label".
  232. If it is found, the contents are used as a lookup into the HELP_LABEL field
  233. in the SYS_HELP database.  NOTE:  It is important that your Help_Label
  234. variable be declared either as PRIVATE or PUBLIC.  If you make it a LOCAL, it
  235. will not be visible to the HELP() function when it is executed.
  236.  
  237. If found, the contents of the TEXT memo field are added to a memory variable
  238. that will be displayed in the Help Window.  The Help_Label variable that is
  239. currently in scope when the Help System is invoked can contain several
  240. individual keys concatenated together with "+".  The primary purpose for this
  241. feature is to allow you to compile a comprehensive help text from several
  242. components that may be used independently of each other. For instance, if you
  243. are working on a financial statements reporting program that has a data entry
  244. screen for "Current Year Budget Dollars", you could define Help_Label keys
  245. for the following subjects/keys:
  246.  
  247. CURRENT YEAR BUDGET DOLLARS:       Dollars
  248. FINANCIAL STATEMENTS:              Statements
  249. RECORD NAVIGATION:                 Record_Nav
  250. EDITING COMMANDS:                  Edit_Command
  251.  
  252.  
  253. Then, at the point where you are actually entering dollar amounts on the
  254. Financial Statements data entry screen, you could define your Help_Label as
  255. "Dollars+Statements+Edit_Commands". When the user presses F1, the On-Line
  256. Help Sub-System will parse the Help_Label string to look for and compile
  257. together the help TEXT for "Dollars", "Statements" and "Edit_Commands".  The
  258. result is a single help text that discusses everything involved in the
  259. current action.  In addition to this, the "Edit_Commands" text can itself be
  260. used in all other cases where editing commands are included in the Help_Label
  261. variable.  Thus, you do not need to write and rewrite the Edit Command help
  262. in every single place where it might be needed  rather you simply include
  263. "Edit_Commands" in each Help_Label variable that needs it and it will be
  264. included in the system generated Help Text.
  265.  
  266. A source code example of the Help_Label might be:
  267.  
  268. *******************************************************
  269. FUNCTION Display_Budget()
  270. LOCAL    Select_Edit
  271. PRIVATE  Help_Label := 'Budget'
  272.  
  273. // issue @ SAY's - display data entry screen for browse only
  274.  
  275. if Select_Edit = TRUE
  276.     Edit_Budget()
  277. endif
  278.  
  279. RETURN(NIL)
  280. *******************************************************
  281.  
  282. FUNCTION Edit_Budget()
  283. PRIVATE  Help_Label := 'Budget+Edit_Commands'
  284.  
  285. // issue @ say/gets
  286.  
  287. READ
  288.  
  289. RETURN(NIL)
  290. *******************************************************
  291.  
  292. If the user presses F1 while in Display_Budget(), the current Help_Label is,
  293. "Budget".  The help system looks through it's SYS_HELP.DBF file and adds the
  294. text from the TEXT field to a memory variable that will be displayed in the
  295. Help Window.
  296.  
  297. However, if the user has selected Select_Edit and the program branches to
  298. "Edit_Budget()", the new PRIVATE Help_Label becomes the Help_Label currently
  299. in scope.  It's contents include "Budget", and also "Edit_Commands".  The
  300. On-Line Help Sub-System again scans it's database file and adds the help text
  301. from the TEXT memo field to it's display memory variable and also adds the
  302. help text for "Editing Commands" to the same display memory variable.  The
  303. end result is a single help text that includes help on budget matters and
  304. also help on editing commands.
  305.  
  306. The flexibility becomes evident when you consider that you may have an half
  307. dozen different editing screens that need on-line help that all include help
  308. on Edit Commands.  But, you do not want to duplicate the edit command help
  309. text in each of the screens.  Instead, you could define Help_Label variables
  310. that have:
  311.  
  312.  
  313. Budget+Edit_Commands
  314. Forecast+Edit_Commands
  315. Consolidate+Edit_Commands
  316. Report_Parameters+Edit_Commands
  317. Financials+Edit_Commands
  318.  
  319. and in each case, the different help texts will be added to the Editing
  320. Commands help to provide comprehensive, context-sensitive and detailed help.
  321. Even though the Edit Commands help text has only been written once, it is
  322. used in many different places.
  323.  
  324. It is possible to add help incrementally as the program goes into greater
  325. depth to give a comprehensive help text detailing everything that has
  326. happened up to the current point:
  327.  
  328. Help_Label := 'Menu+Edit_Option+Budget+Edit_Commands'
  329.  
  330. This example would begin by compiling the TEXT memo field for "Menu" and
  331. continue to add help for "Edit_Option", then for "Budget", and finally
  332. "Edit_Commands", and all four paragraphs will be compiled together and
  333. presented in the Help Window as a single help text.
  334.  
  335. This is precisely how the F2 - Search function works.  It takes the
  336. Help_Label as it currently exists, prompts the user for a word or phrase to
  337. locate, scans all the help TEXT and adds paragraphs to the existing help text
  338. and displays it altogether in the Help Window.
  339.  
  340. The INDEX field is used as a list of topics that are displayed when the users
  341. presses F1 again while in the On-Line Help Sub-System.  This produces a
  342. Topical Pick-List of subjects that are defined in the Help Database.  Once
  343. the list is displayed, the user may pan up and down by using the up and down
  344. arrow keys or the PgUp / PgDn keys.  Once they press ENTER on a subject, the
  345. text of that subject is displayed.
  346.  
  347. User Defined Help
  348.  
  349. Users may also add their own help text to the On-Line Help Sub-System, and
  350. have it along with, but maintained separately from the system defined help.
  351. When the user has pressed F1 to call the On-Line Help, while viewing the
  352. help, they may add their own notes by pressing F4.  The system then gives
  353. them an edit window into which they may add whatever free-form text they
  354. wish. It will always appear here in the same place whenever they press F4.
  355.  
  356. Help File Path
  357.  
  358. The location of the SYS_HELP.DBF is assumed to be the current directory.
  359. This location can be changed by placing the SYS_HELP.DBF and SYS_HELP.DBT
  360. files in any other directory and then naming that directory in a DOS
  361. environment variable called "HELPPATH".  When Help() is invoked, the DOS
  362. environment space is analysed to see if it contains this variable and if it
  363. does it is evaluated to see if it contains any value.  If it exists and
  364. contains a value (namely a directory path), this path is where Help() will
  365. expect to find the help files.
  366.  
  367. This is useful in a network environment where there may be multiple users of
  368. the apllication and you want to ensure that no one user changes or deletes
  369. the SYS_HELP.DBF.  It can be placed in a directory where that user has no
  370. DELETE rights without interfering with their FULL RIGHTS to the work
  371. directory.
  372.  
  373. NOTE:
  374.  
  375. NOTE that Help() is the ONLY Klipper Library function that is not prefixed
  376. with an underscore!  This makes it available simply by specifying it in the
  377. link script because Clipper automatically assigns the F1 key to call a
  378. function named HELP() if it exists.
  379.  
  380. Undoubtedly, a common problem will be setting a HELPPATH to one directory for
  381. one application and then forgetting to set it to another or to NIL when a
  382. different application is loaded.  This can cause two problems.  First, the
  383. user will be presented with help text from a completely foreign application
  384. and second, when they press F1 to get that help, the unknown help key will be
  385. added to the wrong help database.  Therefore, be careful that you correctly
  386. set the HELPPATH variable for each application and reset or remove it as
  387. necessary.
  388.  
  389. The HELPPATH variable can be removed by typing:
  390.  
  391. SET HELPPATH=
  392.  
  393. at any DOS prompt, or, preferably, in the batch file that calls your
  394. application.
  395.  
  396. A good setup batch file might look like:
  397.  
  398. SET HELPPATH=G:\THISAPP\HELPFILE
  399. THISAPP.EXE
  400. SET HELPPATH=
  401.  
  402. Key Summary
  403.  
  404. F1: Initiates the On-Line Help Sub-System.  Once Active:
  405.  
  406. F1: Topical Index
  407. F2: Search for Text in Help Descriptions (HELP_TEXT)
  408. F3: Full Screen Zoom Toggle
  409. F4: User Notes - View/Edit
  410. F5: Print Help Text to Printer
  411. ESC: UnZoom if zoomed (or press F3), or Exit On-Line Help.
  412.  
  413. EDITING HELP "ON-THE-FLY"
  414. -------------------------
  415.  
  416. Help Texts can be edited "on-the-fly" by creating a LOGICAL variable called
  417. __HELPEDIT (it's actual value is not important; it may be either true or
  418. false) that is IN SCOPE when the Help() function is invoked.
  419.  
  420. When the Help() system is invoked, BEFORE the help texts are compiled, an
  421. edit window for each paragraph of help text is presented (with the specific
  422. help_label at the bottom of the window indicating which help text you are
  423. editing).  After you have edited each help text paragraph, the system
  424. compiles them together as it normally would and presents them just as the end
  425. user will see it.
  426.  
  427. __HELPEDIT should be removed from PRODUCTION applications!!!
  428.  
  429. EXAMPLE:
  430.  
  431.  
  432.  
  433. ******************************************************************************/
  434.